﻿using Melee.Controller.Comet;
using Melee.Controller.Request;
using Melee.Controller.Routing;

namespace Melee.Controller.Handlers
{
    public class ListenHandler : RequestHandler
    {
        public ListenHandler() : base(Routes.LISTEN) { }

        public override void Handle(WebRequest webRequest)
        {
            if (Route.Matches(webRequest))
            {
                CometObserverFactory.Observer.Comet(webRequest.Cookie.LoginId, webRequest.Cookie.UserName, webRequest.AsyncResult);
            }
            else
            {
                base.NextHandler.Handle(webRequest);
            }
        }
    }
}
